/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package koor.persistent;

import java.util.List;
import koor.entity.Text;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

/**
 *
 * @author Admin
 */
public class TextDAO extends AbstractDAO<Text> {

    public TextDAO() {
        super();
        setClazz(Text.class);
    }

    @Override
    public List<Text> findByName(String string) {
        Session session = null;
        List<Text> entityList = null;
        try {
            session = getSession();
            entityList = (List<Text>) session.createCriteria(clazz).createCriteria("title").add(Restrictions.eq("title", string)).list();
        } catch (Exception e) {
            //
        } finally {
            if (session != null && session.isOpen()) {
                session.close();
            }
        }
        return entityList;
    }
}
